package com.kede.domain;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.kede.annotation.Query;
import com.kede.base.BaseEntity;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.List;
import java.util.Set;

/**
* @description /
* @author Pr.li
* @date 2023-04-20
**/
@Entity
@Data
@Table(name="resource_file")
public class ResourceFile extends BaseEntity {
    /**
    * 
    */
    @ApiModelProperty(value = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    private Integer id;
    /**
    * 文件真实的名称
    */
    @ApiModelProperty(value = "文件真实的名称")
    @Column(name = "`real_name`")
    private String realName;
    /**
    * 七牛云bucket标识
    */
    @ApiModelProperty(value = "七牛云bucket标识")
    @Column(name = "`bucket`")
    private String bucket;
    /**
    * 文件名
    */
    @ApiModelProperty(value = "文件名")
    @Column(name = "`name`")
    private String name;
    /**
    * 后缀
    */
    @ApiModelProperty(value = "后缀")
    @Column(name = "`suffix`")
    private String suffix;
    /**
    * 存储路径
    */
    @ApiModelProperty(value = "存储路径")
    @Column(name = "`path`")
    private String path;
    /**
    * 类型
    */
    @ApiModelProperty(value = "类型")
    @Column(name = "`type`")
    private String type;
    /**
    * 大小
    */
    @ApiModelProperty(value = "大小")
    @Column(name = "`size`")
    private String size;
    /**
    * 文件关联路径  有http协议为外链，否则是内部页面
    */
    @ApiModelProperty(value = "文件关联路径  有http协议为外链，否则是内部页面")
    @Column(name = "`link`")
    @JSONField(serialzeFeatures = SerializerFeature.WriteNullStringAsEmpty)
    private String link;
    /**
    * 创建者
    */
    @ApiModelProperty(value = "创建者")
    @Column(name = "`create_by`")
    private String createBy;
    /**
    * 更新者
    */
    @ApiModelProperty(value = "更新者")
    @Column(name = "`update_by`")
    private String updateBy;
    /**
    * 创建日期
    */
    @ApiModelProperty(value = "创建日期")
    @Column(name = "`create_time`")
    private Timestamp createTime;
    /**
    * 更新时间
    */
    @ApiModelProperty(value = "更新时间")
    @Column(name = "`update_time`")
    private Timestamp updateTime;
    /**
    * 资源对应 功能类目（与系统枚举ResourceFun对应）
    */
    @ApiModelProperty(value = "资源对应 功能类目（与系统枚举ResourceFun对应）")
    @Column(name = "`function`")
    private Integer function;
    /**
    * 是否本地本地存储
    */
    @ApiModelProperty(value = "是否本地本地存储")
    @Column(name = "`islocal`")
    private Integer islocal;

    public void copy(ResourceFile source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
